<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use common\models\Section;
use common\models\Role;

/* @var $this yii\web\View */
/* @var $model common\models\Admin */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="admin-form">

    <?php $form = ActiveForm::begin(); ?>

    <?= $form->field($model, 'section_id')->dropDownList(Section::find()
        ->select(['section_name','id'])
        ->indexBy('id')
        ->column()
        ,['prompt'=>'请选择部门']) ?>
    <?=$form->field($model, 'roles')->checkboxList(Role::find()
        ->select(['role_name','id'])
        ->indexBy('id')
        ->where(['is_usable'=>1])
        ->column()); ?>

    <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'password')->passwordInput(['maxlength' => true]) ?>

    <div class="form-group">
        <?= Html::submitButton($model->isNewRecord ? '新增' : '修改', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
    </div>

    <?php ActiveForm::end(); ?>

</div>
